package woqu;

import java.util.Arrays;

public class Demo03 {
    public static void main(String[] args) {
        //String str = "sa8sd6s1sd7kw04df23kds59";
        //输出的结果是1，2，3，4，5，6，7，8，9
        String str = "sa8sd6s1sd7kw04df23kds59";
        String[] arr = str.split("[a-z]");        //用正则表达式拆分字符串，满足的替换成空字符串，留下不符合要求的
        System.out.println(Arrays.toString(arr));
        StringBuilder string = new StringBuilder();
        for (int i=0;i< arr.length;i++){
            string.append(arr[i]);
        }
        int a = string.length();
        char[] num = new char[a];
        for (int i=0;i<a;i++){
            num[i] = string.charAt(i);
        }
        Arrays.sort(num);

        String num2 = new String(num);
        System.out.println("String new 对象的字符串:"+num2);

        String num3 = String.valueOf(num);
        System.out.println("valueOf转换的字符串："+num3);

//        StringBuilder string1 = new StringBuilder();
//        for (int i=0;i< num.length;i++){
//            string1.append(num[i]+",");
//        }
//        string1.delete(string1.length()-1,string1.length());
//        System.out.println(string1);
    }
}
